#ifndef ENDCONNECTINSDESTHANDLER_H
#define ENDCONNECTINSDESTHANDLER_H

#include "EndConnectDestHandlerBase.h"
#include "InsteadHttpUrl.h"
#include "Log.h"

class EndConnectInsDestHandler:public EndConnectDestHandlerBase
{
public:
	EndConnectInsDestHandler(const InsteadHttpUrl &url):EndConnectDestHandlerBase(),m_insteadUrl(url){}

	~EndConnectInsDestHandler(){}

protected:
	virtual void GetSendInfo(ClientContext &client,SOCKET *sendSock,OVERLAPPED **sendOvl);

	virtual ITransHandler* GetNextHandler();

	virtual ExecuteResultCode OnExecuteError(ClientContext &client,OVERLAPPED *ovl,ITransHandler::ExecuteResultCode executeResult);

	virtual std::string* AssemblyHttpRequest(ClientContext&);

	virtual WSABUF* FillBufferWithHttpRequest(ClientContext &client,std::string *requestStr);

private:
	static log4cplus::Logger log;

	char* GetCookie(const std::string &url);

	InsteadHttpUrl m_insteadUrl;
};

#endif